<?php

mysql_connect ('192.168.11.10', 'root', 'Gl-1114' );
mysql_select_db('crystal_monitoring');

$mac = $_REQUEST['mac'];

$res = mysql_query("SELECT 	monitoring_computer_state.mac,
                            monitoring_computer_state.screenshot_enabled,
                            monitoring_computer_state.refresh_time
                    FROM 	`monitoring_computer_state`
                    WHERE 	monitoring_computer_state.mac = '$mac'");

$doc = new DomDocument('1.0');

$root = $doc->createElement('SETTINGS');
$doc->appendChild($root);


while ($row = mysql_fetch_assoc($res)) {
    
    $child = $doc->createElement('MAC');
    $root->appendChild($child);
    
    $value = $doc->createTextNode($row['mac']);
    $child->appendChild($value);
    
    $child = $doc->createElement('SCREENSHOT');
    $root->appendChild($child);
    
    $value = $doc->createTextNode($row['screenshot_enabled']);
    $child->appendChild($value);
    
    $child = $doc->createElement('REFRESH');
    $root->appendChild($child);
    
    $value = $doc->createTextNode($row['refresh_time']);
    $child->appendChild($value);   
    
}

$xml_string = $doc->saveXML();

echo $xml_string;

?>
